-
Notifications
You must be signed in to change notification settings - Fork 318
Fix semaphore permit leak in API Security span post-processor #10010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jandro996
wants to merge
7
commits into
master
Choose a base branch
from
alejandro.gonzalez/APPSEC-57815
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 60 metrics, 5 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.105 s) : 0, 1104734
Total [baseline] (8.843 s) : 0, 8842655
Agent [candidate] (1.097 s) : 0, 1097318
Total [candidate] (8.831 s) : 0, 8830582
section iast
Agent [baseline] (1.239 s) : 0, 1238981
Total [baseline] (9.541 s) : 0, 9541423
Agent [candidate] (1.246 s) : 0, 1246062
Total [candidate] (9.539 s) : 0, 9539254
gantt
title insecure-bank - break down per module: candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.497 ms) : 0, 1497
crashtracking [candidate] (1.487 ms) : 0, 1487
BytebuddyAgent [baseline] (710.666 ms) : 0, 710666
BytebuddyAgent [candidate] (705.666 ms) : 0, 705666
GlobalTracer [baseline] (249.548 ms) : 0, 249548
GlobalTracer [candidate] (247.993 ms) : 0, 247993
AppSec [baseline] (32.231 ms) : 0, 32231
AppSec [candidate] (32.023 ms) : 0, 32023
Debugger [baseline] (63.254 ms) : 0, 63254
Debugger [candidate] (62.919 ms) : 0, 62919
Remote Config [baseline] (649.425 µs) : 0, 649
Remote Config [candidate] (639.071 µs) : 0, 639
Telemetry [baseline] (8.287 ms) : 0, 8287
Telemetry [candidate] (8.182 ms) : 0, 8182
Flare Poller [baseline] (3.737 ms) : 0, 3737
Flare Poller [candidate] (3.635 ms) : 0, 3635
section iast
crashtracking [baseline] (1.485 ms) : 0, 1485
crashtracking [candidate] (1.494 ms) : 0, 1494
BytebuddyAgent [baseline] (831.584 ms) : 0, 831584
BytebuddyAgent [candidate] (838.074 ms) : 0, 838074
GlobalTracer [baseline] (237.802 ms) : 0, 237802
GlobalTracer [candidate] (238.07 ms) : 0, 238070
AppSec [baseline] (34.08 ms) : 0, 34080
AppSec [candidate] (33.092 ms) : 0, 33092
Debugger [baseline] (60.053 ms) : 0, 60053
Debugger [candidate] (60.054 ms) : 0, 60054
Remote Config [baseline] (551.346 µs) : 0, 551
Remote Config [candidate] (540.976 µs) : 0, 541
Telemetry [baseline] (7.583 ms) : 0, 7583
Telemetry [candidate] (7.612 ms) : 0, 7612
Flare Poller [baseline] (3.447 ms) : 0, 3447
Flare Poller [candidate] (3.459 ms) : 0, 3459
IAST [baseline] (27.554 ms) : 0, 27554
IAST [candidate] (28.669 ms) : 0, 28669
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.106 s) : 0, 1105991
Total [baseline] (10.77 s) : 0, 10769961
Agent [candidate] (1.108 s) : 0, 1107968
Total [candidate] (10.866 s) : 0, 10866222
section appsec
Agent [baseline] (1.285 s) : 0, 1285059
Total [baseline] (11.162 s) : 0, 11161904
Agent [candidate] (1.284 s) : 0, 1283613
Total [candidate] (11.162 s) : 0, 11161946
section iast
Agent [baseline] (1.239 s) : 0, 1239218
Total [baseline] (11.261 s) : 0, 11260848
Agent [candidate] (1.25 s) : 0, 1250143
Total [candidate] (11.31 s) : 0, 11309842
section profiling
Agent [baseline] (1.232 s) : 0, 1231919
Total [baseline] (11.057 s) : 0, 11057178
Agent [candidate] (1.229 s) : 0, 1229309
Total [candidate] (11.085 s) : 0, 11085380
gantt
title petclinic - break down per module: candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.493 ms) : 0, 1493
crashtracking [candidate] (1.49 ms) : 0, 1490
BytebuddyAgent [baseline] (710.867 ms) : 0, 710867
BytebuddyAgent [candidate] (711.374 ms) : 0, 711374
GlobalTracer [baseline] (249.852 ms) : 0, 249852
GlobalTracer [candidate] (250.351 ms) : 0, 250351
AppSec [baseline] (32.048 ms) : 0, 32048
AppSec [candidate] (32.583 ms) : 0, 32583
Debugger [baseline] (64.013 ms) : 0, 64013
Debugger [candidate] (64.527 ms) : 0, 64527
Remote Config [baseline] (639.127 µs) : 0, 639
Remote Config [candidate] (628.896 µs) : 0, 629
Telemetry [baseline] (8.407 ms) : 0, 8407
Telemetry [candidate] (8.339 ms) : 0, 8339
Flare Poller [baseline] (3.792 ms) : 0, 3792
Flare Poller [candidate] (3.767 ms) : 0, 3767
section appsec
crashtracking [baseline] (1.51 ms) : 0, 1510
crashtracking [candidate] (1.487 ms) : 0, 1487
BytebuddyAgent [baseline] (734.187 ms) : 0, 734187
BytebuddyAgent [candidate] (732.233 ms) : 0, 732233
GlobalTracer [baseline] (241.319 ms) : 0, 241319
GlobalTracer [candidate] (241.232 ms) : 0, 241232
AppSec [baseline] (174.215 ms) : 0, 174215
AppSec [candidate] (174.473 ms) : 0, 174473
Debugger [baseline] (61.256 ms) : 0, 61256
Debugger [candidate] (61.595 ms) : 0, 61595
Remote Config [baseline] (703.163 µs) : 0, 703
Remote Config [candidate] (688.949 µs) : 0, 689
Telemetry [baseline] (8.187 ms) : 0, 8187
Telemetry [candidate] (8.215 ms) : 0, 8215
Flare Poller [baseline] (3.988 ms) : 0, 3988
Flare Poller [candidate] (3.929 ms) : 0, 3929
IAST [baseline] (24.741 ms) : 0, 24741
IAST [candidate] (24.833 ms) : 0, 24833
section iast
crashtracking [baseline] (1.487 ms) : 0, 1487
crashtracking [candidate] (1.49 ms) : 0, 1490
BytebuddyAgent [baseline] (831.494 ms) : 0, 831494
BytebuddyAgent [candidate] (840.277 ms) : 0, 840277
GlobalTracer [baseline] (237.722 ms) : 0, 237722
GlobalTracer [candidate] (239.284 ms) : 0, 239284
AppSec [baseline] (34.887 ms) : 0, 34887
AppSec [candidate] (33.925 ms) : 0, 33925
Debugger [baseline] (60.63 ms) : 0, 60630
Debugger [candidate] (60.89 ms) : 0, 60890
Remote Config [baseline] (545.006 µs) : 0, 545
Remote Config [candidate] (535.705 µs) : 0, 536
Telemetry [baseline] (7.579 ms) : 0, 7579
Telemetry [candidate] (7.574 ms) : 0, 7574
Flare Poller [baseline] (3.454 ms) : 0, 3454
Flare Poller [candidate] (3.514 ms) : 0, 3514
IAST [baseline] (26.404 ms) : 0, 26404
IAST [candidate] (27.618 ms) : 0, 27618
section profiling
ProfilingAgent [baseline] (96.512 ms) : 0, 96512
ProfilingAgent [candidate] (96.988 ms) : 0, 96988
crashtracking [baseline] (1.444 ms) : 0, 1444
crashtracking [candidate] (1.428 ms) : 0, 1428
BytebuddyAgent [baseline] (734.669 ms) : 0, 734669
BytebuddyAgent [candidate] (732.589 ms) : 0, 732589
GlobalTracer [baseline] (222.455 ms) : 0, 222455
GlobalTracer [candidate] (222.214 ms) : 0, 222214
AppSec [baseline] (32.217 ms) : 0, 32217
AppSec [candidate] (32.102 ms) : 0, 32102
Debugger [baseline] (63.047 ms) : 0, 63047
Debugger [candidate] (62.715 ms) : 0, 62715
Remote Config [baseline] (649.626 µs) : 0, 650
Remote Config [candidate] (642.282 µs) : 0, 642
Telemetry [baseline] (8.0 ms) : 0, 8000
Telemetry [candidate] (7.968 ms) : 0, 7968
Flare Poller [baseline] (3.775 ms) : 0, 3775
Flare Poller [candidate] (3.701 ms) : 0, 3701
Profiling [baseline] (97.145 ms) : 0, 97145
Profiling [candidate] (97.564 ms) : 0, 97564
LoadParameters
See matching parameters
SummaryFound 1 performance improvements and 1 performance regressions! Performance is the same for 16 metrics, 18 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section baseline
no_agent (18.491 ms) : 18299, 18684
. : milestone, 18491,
appsec (19.017 ms) : 18819, 19216
. : milestone, 19017,
code_origins (17.639 ms) : 17463, 17814
. : milestone, 17639,
iast (17.87 ms) : 17692, 18048
. : milestone, 17870,
profiling (18.694 ms) : 18503, 18885
. : milestone, 18694,
tracing (17.691 ms) : 17517, 17864
. : milestone, 17691,
section candidate
no_agent (18.344 ms) : 18158, 18531
. : milestone, 18344,
appsec (18.736 ms) : 18547, 18925
. : milestone, 18736,
code_origins (17.748 ms) : 17572, 17924
. : milestone, 17748,
iast (17.959 ms) : 17777, 18141
. : milestone, 17959,
profiling (18.738 ms) : 18550, 18926
. : milestone, 18738,
tracing (17.954 ms) : 17774, 18133
. : milestone, 17954,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section baseline
no_agent (1.2 ms) : 1188, 1212
. : milestone, 1200,
iast (3.101 ms) : 3063, 3139
. : milestone, 3101,
iast_FULL (5.902 ms) : 5842, 5962
. : milestone, 5902,
iast_GLOBAL (3.639 ms) : 3574, 3703
. : milestone, 3639,
profiling (2.178 ms) : 2157, 2198
. : milestone, 2178,
tracing (1.787 ms) : 1772, 1802
. : milestone, 1787,
section candidate
no_agent (1.213 ms) : 1201, 1224
. : milestone, 1213,
iast (3.248 ms) : 3205, 3292
. : milestone, 3248,
iast_FULL (5.822 ms) : 5764, 5880
. : milestone, 5822,
iast_GLOBAL (3.662 ms) : 3606, 3718
. : milestone, 3662,
profiling (1.961 ms) : 1944, 1978
. : milestone, 1961,
tracing (1.832 ms) : 1817, 1848
. : milestone, 1832,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1462, 1485
. : milestone, 1473,
appsec (3.705 ms) : 3486, 3923
. : milestone, 3705,
iast (2.219 ms) : 2154, 2284
. : milestone, 2219,
iast_GLOBAL (2.266 ms) : 2200, 2332
. : milestone, 2266,
profiling (2.08 ms) : 2026, 2133
. : milestone, 2080,
tracing (2.053 ms) : 2001, 2104
. : milestone, 2053,
section candidate
no_agent (1.481 ms) : 1469, 1492
. : milestone, 1481,
appsec (3.774 ms) : 3554, 3993
. : milestone, 3774,
iast (2.218 ms) : 2153, 2283
. : milestone, 2218,
iast_GLOBAL (2.267 ms) : 2201, 2333
. : milestone, 2267,
profiling (2.075 ms) : 2022, 2128
. : milestone, 2075,
tracing (2.058 ms) : 2006, 2109
. : milestone, 2058,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.57.0-SNAPSHOT~3337e0a924, baseline=1.57.0-SNAPSHOT~614cc721f6
dateFormat X
axisFormat %s
section baseline
no_agent (14.962 s) : 14962000, 14962000
. : milestone, 14962000,
appsec (15.168 s) : 15168000, 15168000
. : milestone, 15168000,
iast (18.343 s) : 18343000, 18343000
. : milestone, 18343000,
iast_GLOBAL (17.936 s) : 17936000, 17936000
. : milestone, 17936000,
profiling (14.805 s) : 14805000, 14805000
. : milestone, 14805000,
tracing (14.817 s) : 14817000, 14817000
. : milestone, 14817000,
section candidate
no_agent (15.717 s) : 15717000, 15717000
. : milestone, 15717000,
appsec (14.81 s) : 14810000, 14810000
. : milestone, 14810000,
iast (18.266 s) : 18266000, 18266000
. : milestone, 18266000,
iast_GLOBAL (17.851 s) : 17851000, 17851000
. : milestone, 17851000,
profiling (14.743 s) : 14743000, 14743000
. : milestone, 14743000,
tracing (15.004 s) : 15004000, 15004000
. : milestone, 15004000,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Does This Do
AppSecSpanPostProcessorhad a semaphore permit leak. WhenpreSampleRequest()acquired a permit, but the post-processor encountered early returns (null contexts) before entering the try-finally block,releaseOne()was never called. After 4+ requests with leaked permits, the semaphore was exhausted, preventing subsequent requests from being sampled for API Security.process()method in a try-finally blocksampler.releaseOne()is always called when a permit was acquired, regardless of exceptions or early returnsMotivation
API Security standalone system tests were failing intermittently in CI with
_sampling_priority_v1not being set to 2, causing traces to not be retained as expected.Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]